<template>
  <div class="search">
    <form action="/">
      <van-search
        v-model="key_word"
        show-action
        placeholder="请输入搜索关键词"
        @search="onSearch"
        @cancel="onCancel"
      />
    </form>
    <div class="search-list">
        <p class="p1">搜索历史</p> <p class="p2">全部删除 完成</p>
    </div>
  </div>
</template>

<script>
import { Toast } from "vant";
import {search} from "@/api/api";
export default {
  data() {
    return {
      
      skip:0,
      limit:10,
      key_word:'',
      searchList:[],
    };
  },
  methods: {
    

    onSearch() {
      
      let {skip,limit,key_word} = this
      search(
        {skip,limit,key_word}
      ).then(res=>{
        console.log(res);
        this.searchList=res.data.data;
        console.log(this.searchList)
      })
    },
    onCancel() {
    //   Toast("取消");
      this.$router.push("/")
    },
  },
};
</script>

<style>
.search-list{
    margin: 0 auto;
    display: flex;
    width: 90%;
}
.search-list .p2{
    color: rgb(172, 166, 166);
    width: 50%;
    display: flex;
    justify-content: flex-end
    
}
.search-list .p1{
    /* float: left; */
    width: 50%;
}
</style>